<?php

namespace app\api\validate;

use think\Validate;

class Common extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'position_type' => 'require|number',
        'agreement_type' => 'require|number',
        'keyName' => 'require',
        'cateType' => 'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'position_type.require' => '请选择布局位置',
        'position_type.number' => '布局位置格式不正确',
        'agreement_type.require' => '请选择协议类型',
        'agreement_type.number' => '协议类型格式不正确',
        'keyName.require' => '缺少获取百度accessToken类型的keyName',
        'cateType.require' => '缺少分类类型',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'getBanner' => ['position_type'],
        'getAgreement' => ['agreement_type'],
        'getBaiDuAccessToken' => ['keyName'],
        'getCateList' => ['cateType'],
    ];
}